package awesome.site.loader;

import java.io.File;

import awesome.site.proprietor.SiteProprietor;


/**
 * Launches the FileSystemLoader and ProprietorUpdater sequentially in a thread.
 * 
 * @author Chris Carpenter
 * 
 */
public class SyncThread implements Runnable {
	
	ProprietorUpdater updater;
	FileSystemLoader loader;
	
	public SyncThread(SiteProprietor proprietor, File rootDirectory) {
		this.updater = new ProprietorUpdater(proprietor);
		this.loader = new FileSystemLoader(proprietor, rootDirectory);
	}


	@Override
	public void run() {
		//run updater first so stale files are immediately replaced
		updater.updateProprietor();
		loader.loadFiles();
	}

}
